package cn.com.xyc.test.md5;

import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.junit.Test;

public class PasswordManage {
	@Test
	public void test1() {
		String username="xyc312319@163.com";
		String password="123456";
        String salt=new SecureRandomNumberGenerator().nextBytes().toHex();
        System.out.println(salt);
        int hashIterations=2;
        SimpleHash hash=new SimpleHash("md5", password, username + salt, hashIterations);
        String encodedPassword=hash.toHex();
        System.out.println(encodedPassword);
	}
}
